<div id="content_header">
  <h3>Class List</h3>
</div>

<div class="row">
  <div class="col-md-12 col-lg-12">
    <form method="POST" role="form" ng-submit="searchClass()">
      <div class="row">
        <div class="col-md-8 col-lg-8">
          <div class="row">
            <div class="col-md-4 col-lg-4">
              <div class="form-group">
                <label for="CourseType">Course Type</label>
                <select name="CourseType" class="form-control" id="CourseType" ng-model="filterTable.CourseType.Id" ng-options="coursetype.Id as coursetype.Code +' - '+ coursetype.Name for coursetype in coursetypes" required ng-disabled="termSelected" ng-change="callTerm()">
                  <option value="" ng-hide="filterTable.CourseType.Id">Select a Course Type.</option>
                </select>
              </div>
            </div>
            <div class="col-md-4 col-lg-4">
              <div class="form-group">
                <label for="TermId">Term</label>
                <select name="TermId" class="form-control" id="TermId" ng-model="params.term" ng-options="term.Id as formatTerm(term) group by term.Year for term in terms" required ng-disabled="termSelected">
                  <option value="" ng-hide="params.term">Select Term.</option>
                </select>
              </div>
            </div>
            <div class="col-md-4 col-lg-4">
              <div class="form-group">
                <br>
                <div style="margin-top: 5px;">
                  <button type="submit" class="btn btn-primary">Look Up</button>
                  <button type="button" class="btn btn-default" ng-click="resetTable()">Reset</button>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="col-md-4 col-lg-4 text-right">
          <div class="form-group">
            <br>
            <div class="pull-right" style="margin-top: 5px;">
              <button type="button" title="Previous Term" class="btn btn-info" ng-click="prevTerm()" ng-disabled="checkPrevTerm()"><i class="fa fa-chevron-left"></i></button>
              <button type="button" title="Next Term" class="btn btn-info" ng-click="nextTerm()" ng-disabled="checkNextTerm()"><i class="fa fa-chevron-right"></i></button>
            </div>
          </div>
        </div>
      </div>
    </form>
  </div>
</div>

<div class="row">
  <div class="col-md-6 col-lg-4">
    <div class="form-group">
      <input type="text" name="CourseNameForOrder" id="CourseNameForOrder" class="form-control" ng-model="search.CourseName" placeholder="Search course name">
    </div>
  </div>
  <div class="col-md-6 col-lg-6 col-lg-offset-2">
    <a href="http://203.84.138.181:8081/jasperserver/flow.html?_flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&ParentFolderUri=%2Freports%2FAFAS%2FGELS&reportUnit=%2Freports%2FAFAS%2FGELS%2FAttendance&j_username=jasperadmin&j_password=jasperadmin&TermNumber={{ term.Number }}&TermYear={{ term.Year }}&output=pdf" target="_blank" class="pull pull-right">Print Attendance</a>
  </div>
</div>

<div class="row">
  <div class="col-md-12 col-lg-12">
    <table class="table table-striped table-hover">
      <thead>
        <tr>
          <th>Course</th>
          <th>Student Count</th>
          <th>Teacher</th>
        </tr>
      </thead>
      <tbody>
        <!-- <tr dir-paginate="courseschedule in courseschedules | itemsPerPage: pagesize" total-items="totalItems"> -->
        <tr ng-repeat="courseschedule in courseschedules | filter:search">
          <td>
            <span class="dropdown">
              <a href class="dropdown-toggle" ng-bind-html="courseschedule.CourseName | makeBold:search.CourseName" >
              <!-- {{ courseschedule.Course.CourseLevel.Name }}/{{ courseschedule.Course.CourseLevel.Code }}/{{ courseschedule.Suffix }} -->
              <!-- {{ courseschedule.Course.CourseLevel.Code }} {{ courseschedule.Suffix }} /
              {{ courseschedule.Term.Number }}-{{ courseschedule.Term.Year }} /
              <strong>({{ courseschedule.Enrollments.length || 0 }})</strong> /
              {{ TeacherTypes[courseschedule.Course.TeacherType].Code }} -->

              {{ courseschedule.CourseName }}
              <!-- {{ courseschedule.Course.CourseLevel.Code }} /
              <strong>{{ courseschedule.Suffix }}</strong> /
              {{ TeacherTypes[courseschedule.Course.TeacherType].Code }} -
              <strong>({{ courseschedule.EnrollmentCount }})</strong> -->
              </a>
              <ul class="dropdown-menu">
                <li role="presentation" class="dropdown-header">Action</li>
                <li><a href ui-sref="classes.show.assessment({ id: courseschedule.Id })">Asessment</a></li>
                <li><a href ui-sref="courseSchedules.info({ id: courseschedule.Id })">Info</a></li>
                <li><a href ui-sref="courseSchedules.activities({ id: courseschedule.Id })">Activities</a></li>
                <li><a href ui-sref="classes.show.report({ id: courseschedule.Id })">Class Report</a></li>

                <li><a href="http://203.84.138.181:8081/jasperserver/flow.html?_flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&ParentFolderUri=/reports/AFAS/RC&reportUnit=/reports/AFAS/RC/StudentCard&j_username=jasperadmin&j_password=jasperadmin&TermNumber={{ courseschedule.Term.Number }}&TermYear={{ courseschedule.Term.Year }}&CourseScheduleId={{ courseschedule.Id }}" target="_blank">Student ID Cards</a></li>

                <li ng-if="courseschedule.Course.CourseLevel.CourseType.Id === 2"><a href="http://203.84.138.181:8081/jasperserver/flow.html?_flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&ParentFolderUri=%2Freports%2FAFAS%2FGELS&reportUnit=%2Freports%2FAFAS%2FGELS%2FCertificateGE_Landscape&j_username=jasperadmin&j_password=jasperadmin&TermNumber={{ term.Number }}&TermYear={{ term.Year }}&CourseScheduleId={{ courseschedule.Id }}" target="_blank">Student Reports</a></li>

                <li ng-if="(courseschedule.Course.CourseLevel.CourseType.Id === 1) || (courseschedule.Course.CourseLevel.CourseType.Id === 4)"><a href="http://203.84.138.181:8081/jasperserver/flow.html?_flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&ParentFolderUri=%2Freports%2FAFAS%2FGELS&reportUnit=%2Freports%2FAFAS%2FGELS%2FCertificateYL_Landscape&j_username=jasperadmin&j_password=jasperadmin&TermNumber={{ term.Number }}&TermYear={{ term.Year }}&CourseScheduleId={{ courseschedule.Id }}" target="_blank">Student Reports</a></li>

                <li><a href="http://192.168.80.42:8081/jasperserver/flow.html?_flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&ParentFolderUri=%2Freports%2FAFAS%2FGELS&reportUnit=%2Freports%2FAFAS%2FGELS%2FStudentPhoto&j_username=jasperadmin&j_password=jasperadmin&TermNumber={{ term.Number }}&TermYear={{ term.Year }}&CourseScheduleId={{ courseschedule.Id }}&output=pdf" target="_blank">Student Photos</a></li>
              </ul>
            </span>
          </td>
          <td>
            {{ courseschedule.PaidEnrollmentCount }} <small>paid</small>,
            {{ courseschedule.UnpaidEnrollmentCount }} <small>unpaid</small>
          </td>
          <td ng-if="courseschedule.Staffs.length > 0">
            <div ng-repeat="staff in courseschedule.Staffs"><small>{{ staff.Name }}</small></div>
          </td>
          <td ng-if="courseschedule.Staffs.length === 0">-</td>
        </tr>
      </tbody>
    </table>
  </div>
</div>
<!-- <dir-pagination-controls on-page-change="pageChanged(newPageNumber)" template-url="views/templates/dirPagination.tpl.html"></dir-pagination-controls> -->